package cn.dengta.webapp.user.entity.game;

import cn.dengta.webapp.base.entity.TimeBasedEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import me.codeplayer.util.Cmp;

@Setter
@Getter
@Accessors(chain = true)
@TableName("dt_game_tiger_slot_log")
public class GameTigerSlotLog extends TimeBasedEntity {

	private Long logId;
	/** 游戏id */
	private Long gameId;
	/** 用户id */
	private Long userId;
	/** 购买的倍率 */
	private Integer buyRatio;
	/** 基础倍率 */
	private Integer baseRatio;
	/** 下注金币数 */
	private Integer golds;
	/** 得到的金币数 */
	private Integer received;
	/** 开奖结果 */
	private String lottery;
	/** 游戏视图结果 */
	private String result;
	/** -9=已关闭；状态 0=初始化；9=已开奖 */
	private Integer status;

	/** 是否可开奖 */
	public boolean canLottery() {
		return Cmp.lt(this.status, 9);
	}

	public static GameTigerSlotLog init(Long userId, Long gameId) {
		GameTigerSlotLog log = new GameTigerSlotLog();
		log.setUserId(userId);
		log.setGameId(gameId);
		return log;
	}

}
